package com.douyin.controller;


import com.douyin.dto.PageActionsDTO;
import com.douyin.dto.Result;
import com.douyin.service.FavoritesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 视频收藏表 前端控制器
 * </p>
 *
 * @author k
 * @since 2025-07-27
 */
@Slf4j
@RestController
@RequestMapping("/favorites")
public class FavoritesController {
    @Autowired
    FavoritesService favoritesService;

    /**
     * 用户收藏视频
     * @param videoId
     * @return
     */
    @PostMapping("/addFavorites/{videoId}")
    public Result favoritesOrNot(@PathVariable Long videoId) {
        log.info("addFavorites:{}",videoId);
        return favoritesService.favoritesOrNot(videoId);
    }
    @GetMapping("/getFavorites")
    public Result getFavorites(@RequestBody PageActionsDTO pageActionsDTO) {
        log.info("getFavorites:{}",pageActionsDTO);
        return favoritesService.getFavorites(pageActionsDTO);
    }
}

